#include "glassui.h"
#include <QDebug>
glassui::glassui(QWidget *parent)
    : CglasseFfect(parent)
{
    ui.setupUi(this);

   QObject::connect(ui.horizontalSliderB, &QSlider::valueChanged, this, &glassui::setValueB);
   QObject::connect(ui.horizontalSliderR, &QSlider::valueChanged, this, &glassui::setValueR);
   QObject::connect(ui.horizontalSliderG, &QSlider::valueChanged, this, &glassui::setValueG);
   QObject::connect(ui.horizontalSliderA, &QSlider::valueChanged, this, &glassui::setValueA);
   QObject::connect(ui.horizontalSliderO, &QSlider::valueChanged, this, &glassui::setValueO);

   QVBoxLayout* vboxLayout = new QVBoxLayout(this);
  
   titleBar = new TitleBar(this);
   vboxLayout->addWidget(titleBar,1);
   vboxLayout->addWidget(ui.widget,10);
   vboxLayout->setSpacing(0);
   vboxLayout->setContentsMargins(0, 0, 0, 0);
   titleBar->setMouseTracking(true);
   ui.widget->setMouseTracking(true);


      // setContentsMargins
}

glassui::~glassui()
{}

void glassui::setValueG(int G)
{
    setGlassBackgroundR(G);
    ui.spinBoxG->setValue(G);

    qDebug() << "G" << G;

    update();

}

void glassui::setValueB(int B)
{
    setGlassBackgroundB(B);
    ui.spinBoxB->setValue(B);
    qDebug() << "B" << B;
    update();
}

void glassui::setValueA(int A)
{
    setGlassBackgroundA(A);
    qDebug() << "A" << A;
    ui.spinBoxA->setValue(A);
    update();
}

void glassui::setValueO(int O)
{
    setGlassBackgroundO(O*0.01);
    qDebug() << "O" << O;
    ui.spinBoxO->setValue(O * 0.01);
    update();
}

void glassui::setValueR(int R)
{

    setGlassBackgroundR(R);
    qDebug() << "G" << G;
    ui.spinBoxR->setValue(R);
    update();
}

